/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.db;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "risk_sets")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RiskSets.findAll", query = "SELECT r FROM RiskSets r"),
    @NamedQuery(name = "RiskSets.findById", query = "SELECT r FROM RiskSets r WHERE r.id = :id"),
    @NamedQuery(name = "RiskSets.findByRiskSetCode", query = "SELECT r FROM RiskSets r WHERE r.riskSetCode = :riskSetCode"),
    @NamedQuery(name = "RiskSets.findByIndexCode", query = "SELECT r FROM RiskSets r WHERE r.indexCode = :indexCode"),
    @NamedQuery(name = "RiskSets.findByCtrlLevel", query = "SELECT r FROM RiskSets r WHERE r.ctrlLevel = :ctrlLevel"),
    @NamedQuery(name = "RiskSets.findByCtrlObject", query = "SELECT r FROM RiskSets r WHERE r.ctrlObject = :ctrlObject"),
    @NamedQuery(name = "RiskSets.findByCtrlAssetsCode", query = "SELECT r FROM RiskSets r WHERE r.ctrlAssetsCode = :ctrlAssetsCode"),
    @NamedQuery(name = "RiskSets.findByOwnGroupID", query = "SELECT r FROM RiskSets r WHERE r.ownGroupID = :ownGroupID"),
    @NamedQuery(name = "RiskSets.findByCtrlScene", query = "SELECT r FROM RiskSets r WHERE r.ctrlScene = :ctrlScene"),
    @NamedQuery(name = "RiskSets.findByIsForceIntercept", query = "SELECT r FROM RiskSets r WHERE r.isForceIntercept = :isForceIntercept"),
    @NamedQuery(name = "RiskSets.findByStartDate", query = "SELECT r FROM RiskSets r WHERE r.startDate = :startDate"),
    @NamedQuery(name = "RiskSets.findByEndDate", query = "SELECT r FROM RiskSets r WHERE r.endDate = :endDate"),
    @NamedQuery(name = "RiskSets.findByGateValueA", query = "SELECT r FROM RiskSets r WHERE r.gateValueA = :gateValueA"),
    @NamedQuery(name = "RiskSets.findByGateValueB", query = "SELECT r FROM RiskSets r WHERE r.gateValueB = :gateValueB"),
    @NamedQuery(name = "RiskSets.findByGateValueC", query = "SELECT r FROM RiskSets r WHERE r.gateValueC = :gateValueC"),
    @NamedQuery(name = "RiskSets.findByGateDirectionA", query = "SELECT r FROM RiskSets r WHERE r.gateDirectionA = :gateDirectionA"),
    @NamedQuery(name = "RiskSets.findByGateDirectionB", query = "SELECT r FROM RiskSets r WHERE r.gateDirectionB = :gateDirectionB"),
    @NamedQuery(name = "RiskSets.findByGateDirectionC", query = "SELECT r FROM RiskSets r WHERE r.gateDirectionC = :gateDirectionC"),
    @NamedQuery(name = "RiskSets.findByGateDirectionN", query = "SELECT r FROM RiskSets r WHERE r.gateDirectionN = :gateDirectionN"),
    @NamedQuery(name = "RiskSets.findByGateValueN", query = "SELECT r FROM RiskSets r WHERE r.gateValueN = :gateValueN"),
    @NamedQuery(name = "RiskSets.findByOwnUserID", query = "SELECT r FROM RiskSets r WHERE r.ownUserID = :ownUserID"),
    @NamedQuery(name = "RiskSets.findByAlterUserID", query = "SELECT r FROM RiskSets r WHERE r.alterUserID = :alterUserID"),
    @NamedQuery(name = "RiskSets.findByCreateTime", query = "SELECT r FROM RiskSets r WHERE r.createTime = :createTime"),
    @NamedQuery(name = "RiskSets.findByTimeStamp", query = "SELECT r FROM RiskSets r WHERE r.timeStamp = :timeStamp")})
public class RiskSets implements Serializable {
	public static byte[] EnCode(RiskSets msg) throws IOException {
		Codec<RiskSets> Lcode = ProtobufProxy.create(RiskSets.class);
		return Lcode.encode(msg);
	}
	public static RiskSets DeCode(byte[] data) throws IOException {
	Codec<RiskSets> Lcode = ProtobufProxy.create(RiskSets.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    @Protobuf
	private Integer id;
    @Basic(optional = false)
    @Column(name = "RiskSetCode")
    @Protobuf
	private String riskSetCode;
    @Column(name = "IndexCode")
    @Protobuf
	private String indexCode;
    @Column(name = "CtrlLevel")
    @Protobuf
	private String ctrlLevel;
    @Column(name = "CtrlObject")
    @Protobuf
	private String ctrlObject;
    @Column(name = "CtrlAssetsCode")
    @Protobuf
	private String ctrlAssetsCode;
    @Column(name = "OwnGroupID")
    @Protobuf
	private Integer ownGroupID;
    @Column(name = "CtrlScene")
    @Protobuf
	private String ctrlScene;
    @Column(name = "IsForceIntercept")
    @Protobuf
	private String isForceIntercept;
    @Column(name = "startDate")
    @Temporal(TemporalType.DATE)
    private Date startDate;
	@Protobuf
	private long startDateL;
    @Column(name = "endDate")
    @Temporal(TemporalType.DATE)
    private Date endDate;
	@Protobuf
	private long endDateL;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "GateValueA")
    @Protobuf
	private Float gateValueA;
    @Column(name = "GateValueB")
    @Protobuf
	private Float gateValueB;
    @Column(name = "GateValueC")
    @Protobuf
	private Float gateValueC;
    @Column(name = "GateDirectionA")
    @Protobuf
	private String gateDirectionA;
    @Column(name = "GateDirectionB")
    @Protobuf
	private String gateDirectionB;
    @Column(name = "GateDirectionC")
    @Protobuf
	private String gateDirectionC;
    @Column(name = "GateDirectionN")
    @Protobuf
	private String gateDirectionN;
    @Column(name = "GateValueN")
    @Protobuf
	private String gateValueN;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public RiskSets() {
    }

    public RiskSets(Integer id) {
        this.id = id;
    }

    public RiskSets(Integer id, String riskSetCode) {
        this.id = id;
        this.riskSetCode = riskSetCode;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getRiskSetCode() {
        return riskSetCode;
    }

    public void setRiskSetCode(String riskSetCode) {
        this.riskSetCode = riskSetCode;
    }

    public String getIndexCode() {
        return indexCode;
    }

    public void setIndexCode(String indexCode) {
        this.indexCode = indexCode;
    }

    public String getCtrlLevel() {
        return ctrlLevel;
    }

    public void setCtrlLevel(String ctrlLevel) {
        this.ctrlLevel = ctrlLevel;
    }

    public String getCtrlObject() {
        return ctrlObject;
    }

    public void setCtrlObject(String ctrlObject) {
        this.ctrlObject = ctrlObject;
    }

    public String getCtrlAssetsCode() {
        return ctrlAssetsCode;
    }

    public void setCtrlAssetsCode(String ctrlAssetsCode) {
        this.ctrlAssetsCode = ctrlAssetsCode;
    }

    public Integer getOwnGroupID() {
        return ownGroupID;
    }

    public void setOwnGroupID(Integer ownGroupID) {
        this.ownGroupID = ownGroupID;
    }

    public String getCtrlScene() {
        return ctrlScene;
    }

    public void setCtrlScene(String ctrlScene) {
        this.ctrlScene = ctrlScene;
    }

    public String getIsForceIntercept() {
        return isForceIntercept;
    }

    public void setIsForceIntercept(String isForceIntercept) {
        this.isForceIntercept = isForceIntercept;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
        this.setStartDateL(CodeTool.DateToLong(startDate));
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
		this.setEndDateL(CodeTool.DateToLong(endDate));
    }

    public Float getGateValueA() {
        return gateValueA;
    }

    public void setGateValueA(Float gateValueA) {
        this.gateValueA = gateValueA;
    }

    public Float getGateValueB() {
        return gateValueB;
    }

    public void setGateValueB(Float gateValueB) {
        this.gateValueB = gateValueB;
    }

    public Float getGateValueC() {
        return gateValueC;
    }

    public void setGateValueC(Float gateValueC) {
        this.gateValueC = gateValueC;
    }

    public String getGateDirectionA() {
        return gateDirectionA;
    }

    public void setGateDirectionA(String gateDirectionA) {
        this.gateDirectionA = gateDirectionA;
    }

    public String getGateDirectionB() {
        return gateDirectionB;
    }

    public void setGateDirectionB(String gateDirectionB) {
        this.gateDirectionB = gateDirectionB;
    }

    public String getGateDirectionC() {
        return gateDirectionC;
    }

    public void setGateDirectionC(String gateDirectionC) {
        this.gateDirectionC = gateDirectionC;
    }

    public String getGateDirectionN() {
        return gateDirectionN;
    }

    public void setGateDirectionN(String gateDirectionN) {
        this.gateDirectionN = gateDirectionN;
    }

    public String getGateValueN() {
        return gateValueN;
    }

    public void setGateValueN(String gateValueN) {
        this.gateValueN = gateValueN;
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RiskSets)) {
            return false;
        }
        RiskSets other = (RiskSets) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.db.RiskSets[ id=" + id + " ]";
    }

    public long getStartDateL() {
        return startDateL;
    }

    public void setStartDateL(long startDateL) {
        this.startDateL = startDateL;
		this.startDate = CodeTool.LongToDate(startDateL);
    }

    public long getEndDateL() {
        return endDateL;
    }

    public void setEndDateL(long endDateL) {
        this.endDateL = endDateL;
		this.endDate = CodeTool.LongToDate(endDateL);
    }
    
}
